/**
 * 
 */
package com.tocea.formation.rents;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.tocea.formation.others.Dates;

/**
 * @author AKWilson
 *
 */
public class RentDAOTest {

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		RentDAO rd = new RentDAO();
	}

	/**
	 * Test method for {@link com.tocea.formation.rents.RentDAO#add(com.tocea.formation.users.library.IRentBook)}.
	 */
	@Test
	public final void testAdd() {
		assertTrue(true);
	}

	/**
	 * Test method for {@link com.tocea.formation.rents.RentDAO#update(com.tocea.formation.users.library.IRentBook)}.
	 */
	@Test
	public final void testUpdate() {
		assertTrue(true);
	}

	/**
	 * Test method for {@link com.tocea.formation.rents.RentDAO#get(java.lang.Integer)}.
	 */
	@Test
	public final void testGet() {
		
		Rent r = RentDAO.get(2);
		
		boolean isRightUser = (r.getUser().getId() == 1);
		boolean isRightBook = (r.getBook().getId() == 3);
		
		
		assertEquals(r.getUser().getId().toString(), Integer.toString(1));
		assertEquals(r.getBook().getId().toString(), Integer.toString(3));
		assertEquals(Dates.dateToString(r.getStartDate()), "2011-10-05");
		assertEquals(Dates.dateToString(r.getReturnDate()), "2011-10-12");
	}

}
